package Events.random;

import java.awt.Component;
import java.util.Random;

import javax.swing.JTextArea;

import structures.Spaceship;

public class SandwichHerd implements RandomEvent {

	@Override
	public void execute(Spaceship ship, JTextArea txt, Component parent) {
		Random rnd = new Random();
		int nSandwiches = (int)rnd.nextGaussian()*100 + 250;
		ship.getInventory().changeQuantity(1, nSandwiches);
		if(nSandwiches > 0)
			txt.append("\n\nYou came across a wild herd of sandwiches!\n" + 
						"You collected " + nSandwiches + " from the herd!\n");
		else if (nSandwiches < 0)
			txt.append("\n\nYou came across a wild herd of sandwiches!\n" + 
						-1*nSandwiches + " ran away with the herd!\n");
	}

}
